import { documentList } from "../api/request";
import { Select } from "antd";
import { useRequest } from "ahooks";

interface Props {
    api?: any;
    fieldNames?: { label: string, value: string };
    [key: string]: any;
}

export default function CustomSelect(props: Props) {

    const { data: projectListData, loading } = useRequest(props?.api || documentList)

    return <Select {...props}
        virtual={false}
        options={(projectListData as any)?.data}
        loading={loading}
        placeholder="请选择文档"
        fieldNames={props?.fieldNames ? props?.fieldNames : { label: "projectName", value: "id" }} />
}
